package com.qyhl.webtv.module_news.utils;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import com.weavey.loading.lib.LoadingLayout;

public class MyLoadingLayout extends LoadingLayout {

    private TouchEventListener touchEventListener;

    public void setTouchEventListener(TouchEventListener touchEventListener) {
        this.touchEventListener = touchEventListener;
    }

    public MyLoadingLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyLoadingLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public MyLoadingLayout(Context context) {
        super(context);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (ev.getAction() == MotionEvent.ACTION_MOVE) {
            touchEventListener.moveAction();
        }
        return super.dispatchTouchEvent(ev);
    }

    public interface TouchEventListener {
        void moveAction();
    }
}
